//////////////////////////////////////////////////////////////////////////
///	\file:	TPPlayer.h
///	Copyright (Home) 2010 - All Rights Reserved
///	Author:	Robert.Ma
///	Date:	[2010/01/31]
///	Description:
///		
//////////////////////////////////////////////////////////////////////////
#pragma once
#include "SmartPtr.h"
#include <atlsimpcoll.h>


class CTPFile;

typedef Smart_ptr::SmartPtr<CTPFile>	CTPFilePtr;
typedef CSimpleArray<CTPFilePtr>		CTPFileBuf;
typedef struct tagTrack TRACK;

//////////////////////////////////////////////////////////////////////////
///	\class	CTPPlayer
///	\brief	Player class.
///	\note	Use singleton pattern.
class CTPPlayer
{
public:
	~CTPPlayer(void);

	static int GetTPFileCount();
	static const CTPFile* GetTPFile(int iIndex = -1);
	static int GetTrackCount(int iIndex = -1);
	static const TRACK* GetTrackByIndex(int iTrack = 0, int iIndex = -1);
	static BOOL GetTrack(DWORD dwTime, int& iTrack, const TRACK** ppTrack, int iIndex = -1);
	static BOOL GetCurrent(int& iTrack, int& iIndex);

	static BOOL LoadTPFile(LPCTSTR lpszFile);

	static BOOL RemoveFile(int iIndex);
	static void RemoveAllFiles();

	static BOOL Seek(int iTrack = 0, int iIndex = -1);
	static BOOL Play();
	static BOOL Next();
	static BOOL Prev();
	static BOOL Pause();
	static void Stop();
	static BOOL IsPlayStatus();
	static int GetPlayTime();
	static DWORD GetVolume();
	static void SetVolume(DWORD dwVolume);

private:
	static CTPPlayer* Instance();

	CTPPlayer(void);

	CTPFileBuf	m_fileBuf;
	HANDLE		m_hMPlayer;
	int			m_iCurIndex;
};
